package com.sj.purchase.modules.cost.domain.imei;

import javax.persistence.Embeddable;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import java.io.Serializable;
import java.util.Date;

/**
 * Created by yangrd on 2017/10/21
 **/
@Embeddable
public class InventoryId implements Serializable {

    private String imei;

    @Temporal(TemporalType.TIMESTAMP)
    private Date inStockDate;//入库日期

    public InventoryId() {
    }

    public InventoryId(String imei, Date inStockDate) {
        this.imei = imei;
        this.inStockDate = inStockDate;
    }

    public String getImei() {
        return imei;
    }

    public InventoryId setImei(String imei) {
        this.imei = imei;
        return this;
    }

    public Date getInStockDate() {
        return inStockDate;
    }

    public InventoryId setInStockDate(Date inStockDate) {
        this.inStockDate = inStockDate;
        return this;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        InventoryId that = (InventoryId) o;

        if (imei != null ? !imei.equals(that.imei) : that.imei != null) return false;
        return inStockDate != null ? inStockDate.equals(that.inStockDate) : that.inStockDate == null;
    }

    @Override
    public int hashCode() {
        int result = imei != null ? imei.hashCode() : 0;
        result = 31 * result + (inStockDate != null ? inStockDate.hashCode() : 0);
        return result;
    }
}
